package com.joinway.framework.ecshop.utils

import org.apache.commons.codec.digest.DigestUtils
import org.apache.commons.lang3.StringUtils

final class EcShopUtils {
	
	public static String encrypt(String text, String salt){
		return StringUtils.isBlank(salt) ? encrypt(text) : encrypt(encrypt(text) + salt);
	}
	
	public static String createSalt(){
		return String.valueOf((int)(10000 * Math.random()));
	}
	
	static String encrypt(String text){
		return DigestUtils.md5Hex(text);
	}
	
	static Date convert(long num){
		new Date(num * 1000l)
	}
	
	static String getGender(int flag){
		String gender = "保密"
		
		if(flag == 1){
			gender = "男"
		}else if(flag == 2){
			gender = "女"
		}
		
		gender
	}
	
	private EcShopUtils(){}
}
